// TestLog.cs
//

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

namespace UnitTestHarness
{
    public partial class TestBase
    {
        private static string TestLogJsonTemplate = "{suites:[]}";
    }

    public sealed class TestLogCollection
    {
        public int completed;
        public string collectionName;
        public TestLogSuite[] suites = (TestLogSuite[])new Array();

        public TestLogCollection()
        {
            suites = (TestLogSuite[])Script.Literal("[]");
        }
    }

    public sealed class TestLogSuite
    {
        public int completed;
        public string suiteName;
        public TestLogTest[] tests = (TestLogTest[])new Array();
    }

    public sealed class TestLogTest
    {
        public int completed;
        public string testName;
        //public TestLogResult[] results = (TestLogResult[])new Array();
        public Dictionary<string, TestLogResult> results = new Dictionary<string, TestLogResult>();
    }

    public sealed class TestLogResult
    {
        public int completed;
        public string id;
        public string title;
        public string label = "Empty";
        public object validResult = TestBase.NotAssigned;
        public object lastResult = Script.Literal("undefined");
        public bool passed = false;
        public Date lastRun = TestBase.Never;
        public Date lastPassed = TestBase.Never;
        public bool hasDefault = false;
        public string code;
        public string backgroundColor;

        public TestLogResult SetProperty(string name, string value)
        {
            Type.SetField(this, name, value);
            return this;
        }
    }

}